#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
from lines import*



class TestLines(unittest.TestCase):

    def testInit(self):
        lines = Lines()
        self.assertEqual(lines.get_legends_offset(), (0, 0))

    def test_set_get_curves(self):
        lines = Lines()

        masses = [[50, 55, 52], [100, 101, 103], [150, 151, 154]]
        colors = [(0x55, 0x55, 0xFF), (0xFF, 0x55, 0xFF)]
        names = [u"Yellow Graph", u"Red Graph"]
        curves = [Curve(mass, color, name) for (mass, color, name) in zip(masses, colors, names)]

        lines.set_curves(curves)
        self.assertEqual(lines.get_curves(), curves)
        self.assertEqual(len(lines.get_curves()), 2)
        self.assertEqual(lines.get_curves()[1].mass[2], 103)
        self.assertEqual(lines.get_curves()[0].color, (0x55, 0x55, 0xFF))
        self.assertEqual(lines.get_curves()[0].name, u"Yellow Graph")


if __name__ == "__main__":

    load_case = unittest.defaultTestLoader.loadTestsFromTestCase
    suite = load_case(TestLines)
    #suite.addTest(load_case(Test...))
    unittest.TextTestRunner(verbosity = 2).run(suite)

    #raw_input("press any key")
